﻿#region 命名空间

using System;
using WinnerCMS.BLL;
using WinnerCMS.Common;
using WinnerCMS.Model;

#endregion

namespace WinnerCMS.WebUI.Templates.WinnerCMS6.Member
{
    public partial class Default : WebFactory.ClientPublicPage
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            Page.Title = WebConfig.SiteName + " → 会员中心";
            if (!IsPostBack)
            {
                var myBll = new Public_Member(false);
                if (RightsCheck.IsLogined == false)
                {
                    MsgBox.Message("登录超时，请重新登录。", "Login.aspx", this);
                }
                else
                {
                    var userName = UserManage.Current.UserName;
                    if (string.IsNullOrEmpty(userName) == false)
                    {
                        var model = new UserManage().GetInfo(userName);

                        if (model == null)
                        {
                            myBll.MemberLogout(UserManage.Current.UserName);
                            MsgBox.Message("登录失效，请重新登录。", "Login.aspx", this);

                            return;
                        }
                        this.lblName.Text = model.UserName;
                        this.lblRoleName.Text = "";

                        this.lblPetName.Text = model.PetName;

                        this.lblCoin.Text = model.Coin.ToString();
                        this.lblPoint.Text = model.Point.ToString();
                        this.lblExperience.Text = model.Experience.ToString();

                        this.lblRegTime.Text = model.RegTime.ToShortDateString();
                        this.lblMessageCount.Text = new MessageManage().CountNoRead().ToString();
                    }
                    else
                    {
                        MsgBox.Message("登录失效，请重新登录。", "Login.aspx", this);
                    }
                }
            }
        }
    }
}